<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title>选择登录方式-{eyou:global name='web_name' /}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
<link href="{eyou:global name='web_cmspath' /}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    {eyou:static file="users/skin/css/basic.css" /}
    {eyou:static file="users/skin/css/eyoucms.css" /}
    {eyou:include file="users/skin/css/diy_css.htm" /}
    
    {eyou:static file="/public/static/common/js/jquery.min.js"/}
    {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
    {eyou:static file="users/skin/js/global.js" /}
</head>

<body class="reg">
<div class="register_index ey-member">
    <input type="hidden" id="wechat_url" value="{$eyou.field.wechat_url}">
    <div class="container">
        <button class="btn btn-lg btn-primary btn-block" style="width: 100%;" onclick="wechat_login();" >
            微信登录
        </button>
        <br/>
        {eyou:if condition="!isset($usersConfig['users_open_website_login']) || 1 == $usersConfig['users_open_website_login']"}
            <a href="{$eyou.field.website_url}" style="color: white">
                <button class="btn btn-lg btn-primary btn-block" style="width: 100%;" >
                    本站登录
                </button>
            </a>
        {/eyou:if}
    </div>
</div>

<script type="text/javascript">
    // 使用微信登录
    function wechat_login()
    {
        var wechat_url = $('#wechat_url').val();
        if (!wechat_url) {
            showErrorAlert('网络失败，请刷新页面后重试');
        }
        layer_loading('正在处理');
        $.ajax({
            url: wechat_url,
            data: {data:0},
            type: 'post',
            dataType:'json',
            success:function(res){
                layer.closeAll();
                if (res.code == 1) {
                    window.location.href = res.url;
                } else {
                    layer.msg(res.msg, {time: 2000, icon: 5});
                }
            },
            error : function(e) {
                layer.closeAll();
                showErrorAlert(e.responseText);
            }
        });
    };
</script>
</body>
</html>